﻿using Inovout;
using Inovout.Data.Domain;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KuaJing.Security.Domain
{
    public partial class MailCredential : MembershipUserCredential
    {
        public MailCredential()
        {
        }
        [Required(ErrorMessage = "邮箱不可为空")]
        [StringLength(50, ErrorMessage = "邮箱长度不能超过50个字符")]
        [Alias("邮箱名")]
        public virtual string Name { get; set; }
        public virtual string Domain { get; set; }
        private string mail;


        public virtual string Mail
        {
            get { return mail; }
            set
            {
                mail = value.ToLower();
                int @Location = mail.IndexOf("@");
                this.Name = mail.Substring(0, @Location);
                this.Domain = mail.Substring(@Location + 1, mail.Length - @Location - 1);
            }
        }
    }
}
